<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style>
     div{
	    width:100px;
		height:100px;
		border:solid 1px black;
		margin-bottom:10px;
	 }
  </style>
  <script src="jQuery复习/jquery-3.3.1.js"></script>
 </head>
 <body>
    <div> <p>11111</p> </div>
	<div>22222</div>
	<div> <span>22222</span> </div>
	<div></div>
 </body>
 <script>
    //匹配含有指定文本的元素
	$("div:contains(222)").css({"backgroundColor":"yellow"});

    //匹配所有不包含子元素或文本的元素
	$("div:empty").css({"backgroundColor":"blue"});
    
	//匹配含有选择器所匹配的元素的元素
	$("div:has(p)").css({"backgroundColor":"red"});

	//匹配所有含有子元素或文本的元素
	$("div:parent").css({"backgroundColor":"white"});
 </script>
</html>
